<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="Dao.BookDao" %>
<%@ page import="java.sql.SQLException" %><%--
  Created by IntelliJ IDEA.
  User: Muerzhi
  Date: 2023/12/25
  Time: 20:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
  String reId=request.getParameter("reId");
  String reName=request.getParameter("reName");
  String reAuthor=request.getParameter("reAuthor");
  String reHouse=request.getParameter("reHouse");
  String reMoney=request.getParameter("reMoney");


  BookDao bookDao = new BookDao();
    int i = 0;
    try {
        i = bookDao.updateBook(reName,reAuthor,reHouse,reMoney,reId);
    } catch (SQLException e) {
        e.printStackTrace();
    }
    if (i !=0){
    out.println("<script>");
    out.println("alert('书籍《"+reName+"》修改成功');");
    out.println("location.href='index.jsp'");
    out.println("</script>");
  }else{
    out.println("<script>");
    out.println("alert('书籍《"+reName+"》修改失败');");
    out.println("location.href='index.jsp'");
    out.println("</script>");
  }
%>
</body>
</html>
